<%@page import="helpers.LastSearchHelper"%>
<%@page import="helpers.HeaderHelper"%>
<%@page import="helpers.ItuneXMLUrlHelper"%>
<%@page import="helpers.CountryHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="helpers.StringHelper"%>
<%@page import="models.Country"%>
<%@page import="models.Software"%>
<%@page import="java.util.ArrayList"%>
<%
	HeaderHelper headerHelper = (HeaderHelper) request.getAttribute("headerHelper");
    ArrayList<Software> softwares = (ArrayList<Software>) request.getAttribute("softwares");
    String v = (String) request.getAttribute("v");
%>

<jsp:include page="/layouts/header.jsp">
    <jsp:param name="title" value="<%=headerHelper.getTitle()%>" />
    <jsp:param name="description" value="<%=headerHelper.getDescription()%>" />
    <jsp:param name="keywords" value="<%=headerHelper.getKeywords()%>" />
    <jsp:param name="ogite_name" value="<%=headerHelper.getOgite_name()%>" />
    <jsp:param name="ogtitle" value="<%=headerHelper.getOgtitle()%>" />
    <jsp:param name="ogurl" value="<%=headerHelper.getOgurl()%>" />
    <jsp:param name="ogimage" value="<%=headerHelper.getOgimage()%>" />
    <jsp:param name="ogescription" value="<%=headerHelper.getOgescription()%>" />
</jsp:include>
<script type="text/javascript">
<!--
$(document).ready(function () {
	$('.item-block .app-ranking').hover(
		function () {
			$(this).addClass("app-ranking-hover");
			$(this).find(".app-number").addClass("app-number-hover");
		},
		function () {
			$(this).removeClass("app-ranking-hover");
			$(this).find(".app-number").removeClass("app-number-hover");
		}
	);
});
//-->
</script>	
		<!-- 2 - top content -->
    	<div id="top-content">
    		<!-- 3 - top-content left -->
    		<div class="left">
    			<div class="item">
    				<div class="thumbnail" style="border: 1px solid #636363;"><img src="/images/1stapp.jpg"></div>
    				<div class="info">
    					<div class="info-top">
    						<h1><a href="#">Top Apps for iPhone, iPad</a></h1>
    						<div class="desc">
    							<h2>Best top applications free and paid for iPhone, iPad</h2>
    							<div class="clear"></div>
								<abbr title="Top iphone free, top iphone paid, top iphone grossing, top ipad free, top ipad paid, top ipad grossing, top new free, top new paid, top new grossing"> Top iphone free, top iphone paid, top iphone grossing, top ipad free, top ipad paid, top ipad grossing, top new free, top new paid, top new grossing.</abbr><br>
    						</div>
    					</div>
    					<div class="social-buttons">
    						<!-- AddThis Button BEGIN -->
							<div class="addthis_toolbox addthis_default_style">
								<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
								<a class="addthis_button_tweet"></a>
								<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
								<a class="addthis_counter addthis_pill_style"></a>
							</div>
							<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f4f217074402877"></script>
							
							<!-- AddThis Button END -->
    					</div>
    				</div>
    			</div>
    		</div>
    		<!-- 3 - end top-content left -->
    		
    		<!-- 3 - top-content right -->
    		<div class="right">
    			<div class="extra">
    				<div class="e-item">
    					<div class="block">
    						<div class="sprite-icon"></div>
    						<span class="feature-icon">Country</span>
    					</div>
    					<div class="block">
    						<span></span>
    					</div>
    					<div class="clear"></div>
    				</div>
    				
    				<div class="e-item">
    					<div class="block">
    						<div class="sprite-icon"></div>
    						<span class="feature-icon">Category</span>
    					</div>
    					<div class="block">
    						<span></span>
    					</div>
    					<div class="clear"></div>
    				</div>
    				<div class="e-item">
    					<div class="block">
    						<div class="sprite-icon"></div>
    						<span class="feature-icon">Top size</span>
    					</div>
    					<div class="block">
    						<span></span> apps
    					</div>
    					<div class="clear"></div>
    				</div>
    			</div>
    		</div>
    		<!-- 3 - end top-content right -->
			<!-- 3 - menu-tabs -->
			<ul class="menu-tabs">
				<li>
				</li>
			</ul>
			<!-- 3 - end menu-tabs -->
			
    	</div>
    	<!-- 2 - end top content -->
    	
    	<!-- 2 - main-content -->
    	<div class="main-content">
    		<!-- 3 - left-pane -->
    		<div class="left-pane">
    			<!-- 4 - head-link -->
    			<div class="head-link title">
    				<h1 style="color: #3472BB; margin: 6px 0pt 0pt 3px; font-size: 30px; font-weight: bold;">
    					<span style="color: #82ABDD">Result for </span> <%=v.replace("+", " ")%>
    					</h1>
					<h2 class="r-subtitle" style="margin: 17px 0pt 0pt 3px; color: #4898C0; font-size: 16px;">
						Found <%=softwares.size() %> applications on 1stapp.org
					</h2>
					<div class="clear"></div>
    			</div>
    			<!-- 4 - end head-link -->
    			
    			<!-- 4 - list-item -->
    			<div class="list-item">
    				<div class="item-block">
    					<% 
    					Software software = new Software();
    					String classRanking = "";
    					String ext = "";
    					for (int i = 0; i < softwares.size(); i++) { 
    						software = softwares.get(i);
    						if (i + 1 < 10) {
    							classRanking = "large";
    						} else if( i + 1 < 100) {
    							classRanking = "medium";
    						} else {	
    							classRanking = "small";
    						}
    					%>
    					<div class="app-ranking">
    						<div class="app-number">
    							<span class="ranking <%=classRanking%>"><%=i+1%></span>
    						</div>
    						<div class="app-info">
    							<div class="inner-app">
    								<h3 class="title-app"><a href="/i/<%=StringHelper.getAlias(software.getTrackName()) + "-" + software.getTrackId()%>"><%=software.getTrackName() %></a></h3>
    								<div class="description"><%=StringHelper.cutString(software.getDescription().getValue(), 22)%>...</div>
    								<h4 class="other"><%=software.getCategory() %></h4>
    							</div>
    							<div class="image">
    								<a href="/i/<%=StringHelper.getAlias(software.getTrackName()) + "-" + software.getTrackId()%>">
    									<% ext = StringHelper.getFileExtend(software.getArtworkUrl100()); %>
    									<img src="<%=ext.equalsIgnoreCase("tif") || ext.equalsIgnoreCase("tiff") ? software.getArtworkUrl60() : software.getArtworkUrl100() %>" />
    								</a>
    								<div class="price"><%=software.getPrice() == 0 ? "Free" : "$" + software.getPrice()%></div>
    							</div>
    						</div>
    						<div class="clear"></div>
    					</div>
    					<% } %>
    				</div>
    			</div>
    			<!-- 4 - end list-item -->
    		</div>
    		<!-- 3 - end left-pane -->
    		
    		<!-- 3 - right-pane -->
    		<jsp:include page="/elements/right.jsp" />
    		<!-- 3 - end right-pane -->
    		
    		<div class="clear"></div>
    	</div>
    	<!-- 2 - end main-content -->
<jsp:include page="/layouts/footer.jsp">
    <jsp:param name="language" value="1" />
</jsp:include>